/*
 * request_viewer_form.c
 * This file is part of gURL
 *
 * Copyright (C) 2013 - Aleksey Konovalov
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "request_viewer_form.h"

#include "defines.h"
#include "request_panel.h"
#include "response_panel.h"

struct _RequestViewerForm {
    GtkPaned parent;
    GtkWidget *request_panel, *response_panel;
};

struct _RequestViewerFormClass {
    GtkPanedClass parent_class;
};

G_DEFINE_TYPE(RequestViewerForm, request_viewer_form, GTK_TYPE_PANED)

static void request_viewer_form_class_init(RequestViewerFormClass* UNUSED(klass)) {}

static void request_viewer_form_init(RequestViewerForm* self) {
    self->request_panel = request_panel_new();
    gtk_widget_show(self->request_panel);
    gtk_paned_pack1(GTK_PANED(self), self->request_panel, TRUE, FALSE);
    self->response_panel = response_panel_new();
    gtk_widget_show(self->response_panel);
    gtk_paned_pack2(GTK_PANED(self), self->response_panel, TRUE, FALSE);
}

void request_viewer_set_session(RequestViewerForm* rv, Session* session) {
    request_panel_set_session(REQUEST_PANEL(rv->request_panel), session);
    response_panel_set_session(RESPONSE_PANEL(rv->response_panel), session);
}

GtkWidget* request_viewer_form_new() {
    return g_object_new(REQUEST_VIEWER_FORM_TYPE,
                        "orientation", GTK_ORIENTATION_VERTICAL, NULL);
}
